<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>个人中心</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css" />
      <link rel="stylesheet" type="text/css" href="../../css/common.css" />
      <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    	<link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
      <style>
          html, body {width: 100%;min-height: 100%;background: #ffffff;}
          .aui-active .aui-bar-tab-label{
            color: #f5a51c
          }
          .login {height:10rem;background-image: -webkit-linear-gradient(0deg, #f5c674, #ed824c);/*background-image: url(../../image/personal_bkg.jpg);background-repeat: no-repeat; background-size: cover;*/position: relative;}
      	.login .personal_logo {margin: 0 auto 9px;/*position: absolute; top: 60px; left: 20px;*/}
      		.login .userinfo {position: absolute;text-align: center; left: 0; right: 0;}
      		.login .userinfo .title {font-size: 0.8rem; color: #fff;}

      		/* 设置条目 */
      		.item {height: 3rem;line-height: 3rem;padding-left: 0.7rem;background-color: #fff;}
      		.item_ico {float: left;width: 2.3rem;padding: 0.7rem 0.7rem 0.7rem 0;}
      		.item_arrow {float: right;width: 1.5rem;padding: 1rem 0.7rem 1rem 0;}
      		.item span {font-size: 0.7rem;}
          [v-cloak] {
              display: none;
          }
          .myshop_bouned_main{
            display: flex;
            align-items: center;
            justify-content: space-around;
            margin-bottom: 0.3rem
          }
          .myshop_bouned_title{
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-left: 0.75rem;
            padding-right: 0.75rem;
            margin-bottom: 2rem;
          }
          .myshop_bouned_content{
            position: fixed;
            bottom: 0;
            z-index: 9999;
            background: #fff;
            width: 100vw;
            display:none;
          }
      </style>
  </head>
  <body>
<div id="app" v-cloak>
  <div class="user_nav_line"></div>
  <div class="aui-content">
  <ul class="aui-list aui-media-list">
    <li class="aui-list-item aui-list-item-middle" v-for="item in list">
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-inner">
                <div class="aui-list-item-text">
                    <div class="aui-list-item-title aui-font-size-14">
                      <div v-if="item.username" style="margin-bottom: 0.1rem;">{{item.username}}</div>
                      <div v-else style="margin-bottom: 0.1rem;">未知产品</div>
                      <div style="font-size:0.6rem;color:#999">{{item.posttime}}&nbsp;来源于：{{item.way_name}}</div>
                    </div>
                    <div class="aui-list-item-right" style="font-size: 0.8rem;color: #f23030;">￥{{item.amount | jiemi}}</div>
                </div>
            </div>
        </div>
      </li>
    </ul>

</div>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/zepto.js"></script>
  <script type="text/javascript" src="../../script/vue.min.js"></script>
  <script type="text/javascript" src="../../script/utils.js"></script>
  <script type="text/javascript" src="../../script/common.js"></script>
  <script type="text/javascript" src="../../script/aui-tab.js"></script>
  <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  <script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
  <script type="text/javascript">

    var header_top = $api.byId('header_top');
    var header_topPos = $api.offset(header_top);
      function price_about(){
        api.openWin({
            name: 'priceAbout',
            url: './headerone.html',
            pageParam: {
                  msg:'',
                  url:''
            }
        });

      }
      function goback(){
        api.closeWin();
      }


      apiready = function(url){
        var app = new Vue({
            el: '#app',
            data: {
                token: '',
                list: [],
                page: 1,
                totalpage: 1
            },
            created: function() {
                var $_this = this;
                $_this.token = $api.getStorage('token') || '';
                api.ajax({
                    url: window.Url.Freeucenter_balanceCommission,
                    method: 'post',
                    data: {
                        values: {
                            token: $_this.token,
                            page: $_this.page
                        }
                    }
                }, function(ret, err) {
                    if (ret.re == 1) {
                        $_this.list = ret.data.list
                        $_this.totalpage = ret.sum_page
                    }else {
                      api.toast({
                          msg: ret.info,
                          duration: 1000,
                          location: 'bottom'
                      });
                    }
                    console.log(JSON.stringify(ret));
                });

                var scroll = new auiScroll({
                    listen: true, //是否监听滚动高度，开启后将实时返回滚动高度
                    distance: 40 //判断到达底部的距离，isToBottom为true
                }, function(ret) {
                    if (ret.isToBottom) {
                        $_this.page++
                            if ($_this.page > $_this.totalpage) {
                                $_this.page = $_this.totalpage
                                return
                            }
                        api.ajax({
                            url: window.Url.Freeucenter_balanceRecordList,
                            method: 'post',
                            data: {
                                values: {
                                    token: $_this.token,
                                    page: $_this.page
                                }
                            },
                            timeout: 300,
                        }, function(ret, err) {
                            if (ret) {
                                //  api.alert({ msg: JSON.stringify(ret) });
                                $_this.list = $_this.list.concat(ret.data.list)
                            } else {
                                api.alert({
                                    msg: JSON.stringify(err)
                                });
                            }
                        })
                    }

                })
            },
            filters: {
                jiemi:function(val) {
                  return Base64.decode(val).slice(3,-5)
                },
            }
         })
      };


      //刷新
      function setRefresh() {
          var pullRefresh = new auiPullToRefresh({
              container: document.querySelector('.aui-refresh-content'),
              triggerDistance: 100
          }, function(ret) {

              if (ret.status == "success") {
                  setTimeout(function() {
                      pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                  }, 1500)
              }
          })
      }

  </script>
  </html>
